<div class="content noPad clearfix">
                                    <table cellpadding="0" cellspacing="0" border="0" class="responsive dynamicTable display table table-bordered" width="95%" id="imageslist">
                                        <thead>
                                        	<tr>
                                             <th  class="first-col" style="text-align:center; border-left:1px solid #dddddd;">Stt</th>
                                                <th>Link URL</th>        
                                                <th width="256">Hình ảnh</th> 
                                                 <th width="">Chèn hình</th>             
                                                <th width="5%">Xóa</th> 
                                            </tr>  
                                        </thead>
                                        <tbody>
                                        <?php 
										if (isset($images) && $images!=NULL):

										$i=0;
											foreach ($images as $row){?>
											<tr>
												<td align="center" style="text-align:center; border-left:1px solid #dddddd;"><?php echo $i+1;?></td>
												<td><?php echo image_src($row->NEWS_PATCH);?></td>
												<td class="text-align-center" align="center"><a href="<?php echo image_src($row->NEWS_PATCH);?>" target="_blank"><img src="<?php echo image_src($row->NEWS_PATCH);?>" style="height:64px;"/></a></td>
												<td>

                                                        <a class="" onclick="InsertToContent($(this).attr('rel')); return false;" href="javascript:void(0);" rel="<?php echo image_src($row->NEWS_PATCH);?>"><span class="btn">Chèn</span></a>

                                                </td>
                                                <td>

                                                        <a class="tip deleteimage" href="javascript:void(0);" rel="<?php echo $row->NEWSI_ID?>">
                                                        	<span class="icon12 icomoon-icon-remove"></span>
                                                         </a>

                                                </td>
											</tr>
											<?php $i++;}
											endif;
											?>
                                        </tbody>
                                     	<thead>
                                        	<tr>
                                            	<th colspan="5">
                                                	<div id="target"></div>
                                                </th>
                                            </tr>
                                        	<tr>
                                            	<th colspan="5">
                                                   <link href="<?php echo $this->template->url_theme_admin; ?>js/uploadify/uploadify.css" type="text/css" rel="stylesheet">
                            <script src="<?php echo $this->template->url_theme_admin; ?>js/uploadify/swfobject.js" type="text/javascript"></script>        
                            <script src="<?php echo $this->template->url_theme_admin; ?>js/uploadify/jquery.uploadify.min.js" type="text/javascript"></script>
          <div id="target" class="gridview-toolbar">

</div>





<div>
 
	<form method="post" action="<?php echo admin_url().'soft/do_upload_products_image/';?>"  enctype="multipart/form-data">

    <?php //echo form_open_multipart(admin_url().'soft/do_upload_products_image/');?>
      <?php //echo form_upload(array('name' => 'imagesdetail', 'id' => 'upload'));?>
	  <input type="file" id="upload" name="imagesdetail" class="" value=""  />
<!--      <input type="submit" value="Upload"/> -->
<!--      <a href="javascript:$('#uploadifyit').uploadifyUpload();" id="uploadfile" class="btn-big-grey" style="clear:both; margin-top:10px;"><span>Tải tệp tin lên server</span></a> -->
</form>
<?php //echo form_close();?>
</div>

<style>
#uniform-upload {width:120px;}
</style>
<script type="text/javascript">
	$("#").parent().width(120);
</script>
<script type="text/javascript" language="javascript">
$(document).ready(function(){
	$('#uploadfile').click(function(){
	
	//$('#upload').uploadifySettings('scriptData', obj);
	$('#upload').uploadifyUpload();
});

// Your paths to the uploadify.swf and cancelImg may need to be modified for your set up

$("#upload").uploadify({
	uploader: '<?php echo $this->template->url_theme_admin; ?>js/uploadify/uploadify.swf',
	script: '<?php echo admin_url().'news/do_upload_products_image'; ?>',
	cancelImg: '<?php echo $this->template->url_theme_admin; ?>js/uploadify/cancel.png',
	folder: 'uploads/',
	scriptData: {'param1': '<?php echo @$news->NEWS_ID;?>'},
	
	scriptAccess: 'always',
	removeCompleted:false,			
	multi: true,
	sizeLimit:1024000,
	fileDesc : 'jpg,png,gif,jpeg',
	fileExt : '*.jpg;*.png;*.gif;*.jpeg',
	wmode:'transparent',
	queueSizeLimit:100,
	buttonText: 'Select image file',
	auto:true,
/*	'onError'     : function (event,ID,fileObj,errorObj) {
	      alert(errorObj.type + ' Error: ' + errorObj.info);
    }, */
	'onOpen' : function(){} ,
	
	'onError' : function (a, b, c, d) {
		 if (d.status == 404)
				alert('Could not find upload script.');
		 else if (d.type === "HTTP")
				alert('error '+d.type+": "+d.status);
		 else if (d.type ==="File Size")
				alert(c.name+' '+d.type+' Limit: '+Math.round(d.sizeLimit/1024)+'KB');
		 else
				alert('error '+d.type+": "+d.text);
	}, 
	'onComplete'   : function (event, queueID, fileObj, response, data) {
		$.post('<?php echo site_url('administrator/upload/uploadify'); ?>',{message: response},function(info){
				 //Add response returned by controller
			//	$("#target").html(response); 
				$("#target").append(info);
		});
	
		
	},
	 'onAllComplete': function(event,data){
		$.ajax({
		  type: 'POST',
		  url: '<?php echo admin_url().'products/getimagelist'?>',
		  data: 'id=<?php echo @$IDEdit;?>',
		  success: function(data){
				$('#imageslist tbody').html(data);
			}
		});
	 }

});
	$(".btn-big-grey").button();	
	
	$(".deleteimage").live("click", function(){
			var id=$(this).attr('rel');
			var my=$(this);
			$.ajax({
				  type: 'POST',
				  url: '<?php echo admin_url().'/news/deleteimage';?>',
				  data: 'id='+id,
				  success: function(data){
					  if (data.length<=0)
					  {
						 $(my).parent().parent().remove();	 
					  }
					  else
					  	alert(data);
				},
                error:function (xhr, ajaxOptions, thrownError){
                    alert(xhr.responseText);
                }    
			});
	return false;
		});
		
});
</script>
                                                </th>
                                            </tr>
                                        </thead>
                                    </table>
                                </div>